/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package chapter3;

/**
 *
 * @author Denise Carolina
 */
public class WrapperAndBoxing {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        //xxxValue() i: nothing o:primitive type

        Integer i2 = new Integer(42);
        byte b2 = i2.byteValue();
        int i3 = i2.intValue();
        short s1 = i2.shortValue();

        Float f2 = new Float(3.14f);
        int i4 = f2.intValue();
        short s3 = f2.shortValue();

        System.out.println("s3:: " + s3);

        //parseXXX() i: String o: primitive
        double d4 = Double.parseDouble("12.3");
        float f4 = Float.parseFloat("12.34");
        System.out.println("d4:: " + d4 + " f4:: " + f4);

        // valueOf() i:String o:Wrapper
        Double d5 = Double.valueOf("3.14");
        System.out.println("d5 instanceof Double:: " + (d5 instanceof Double) + " toString:: " + d5.toString());

        // Difference between valueOf and parseXXX specific base
        long l1 = Long.parseLong("101010", 2);
        Long l3 = Long.valueOf("101010", 2);

        System.out.println("l1:: " + l1 + " l3:: " + l3);

        // toString //pag 242
        System.out.println(Double.toString(3.14));
        
        System.out.println(Long.toString(256, 16));

        System.out.println(Integer.toHexString(254));
        System.out.println(Long.toOctalString(254));

    }

}
